package service.Impl;

import bean.ClassB;
import dao.IClassBDao;
import dao.impl.ClassBDaoImpl;
import service.IClassBService;
import util.PageUtil;

import java.util.List;

public class ClassBServiceImpl implements IClassBService {

    IClassBDao icb =new ClassBDaoImpl();
    @Override
    public PageUtil<ClassB> listByPage(int pageNo, int pageSize) {
        List<ClassB> classBList =icb.listByPage(pageNo,pageSize);
        int count =icb.getCount();
        PageUtil<ClassB> pages =new PageUtil<>(classBList,count,pageNo,pageSize);
        return pages;
    }

    @Override
    public boolean addOneClass(ClassB cb) {
        return icb.addOneClass(cb)>0?true:false;
    }

    @Override
    public boolean updateOneClass(int id, String f_leader, String f_tel) {
        return icb.updateOneClass(id,f_leader,f_tel)>0?true:false;
    }

    @Override
    public PageUtil<ClassB> listByPage(int pageNo, int pageSize, String f_className, String f_areaName) {
        List<ClassB> cbs =icb.listByPage(pageNo,pageSize,f_className,f_areaName);
        int count =icb.getCount(f_className,f_areaName);
        PageUtil<ClassB> pages =new PageUtil<>(cbs,count,pageNo,pageSize);
        return pages;
    }
}
